<!DOCTYPE html>
<html>
<body>
<div id="app"></div>
<script src="https://unpkg.com/vue@next"></script>
<script src="https://cdn.jsdelivr.net/npm/vue3-sfc-loader"></script>
<script>

    const options = {

        moduleCache: {
            vue: Vue,
        },

        getFile(url) {
            return fetch(url).then(response => {
                // console.log(!!response.ok);
                if(response.ok){
                    console.log(response);
                    return response.text()
                }else{
                    Promise.reject(response)
                }
            }).then(res1=>{
                console.log(res1);
                return  Promise.resolve(res1)
            })
        },

        addStyle: () => {},
    }

    const { loadModule, version } = window["vue3-sfc-loader"];

    const app = Vue.createApp({
        components: {
            'my-component': Vue.defineAsyncComponent(() => loadModule('./myComponent1.vue', options)),
        },
        template: `Hello <my-component></my-component> <sub>from vue3-sfc-loader v${ version }</sub>`
    });

    app.mount('#app');
</script>
</body>
</html>
